<?php
namespace Models;
class User extends Model {
    public function getUserByUsername($username) {
        $sql = 'select * from users where username = "' . $username . '" limit 1';
        $result = $this->pdo->query($sql);
        $result = $result->fetch();
        return $result;
    }

    public function createUser($username, $password) {
        $sql = 'insert into users (username, password) values (:username, :password)';
        $stmt = $this->pdo->prepare($sql);
        return $stmt->execute(
            [
                ':username' => $username,
                ':password' => md5($password)
            ]
        );
    }
}